object BasicFunctionDemo extends App {
  def printWelcomeMessage(): Unit = {
    println("============学生信息查询系统===========")
    println("欢迎学生使用信息查询功能")
    println("====================================")
  }
  def getStudentName(studentId:String): String = {
    val studentMap = Map(
      "S2025001"->"张三",
      "S2025002"->"李四",
      "S2024003"->"王五",
      "S2024004"->"赵六"
    )
    studentMap.getOrElse(studentId,"未知学生")
  }
  def calculateAverageScore(score : List[Int]): Double ={
    if (score.isEmpty)0.0
    else score.sum.toDouble / score.size
  }
  printWelcomeMessage()
  val studentId = "S2025002"
  val studentName = getStudentName(studentId)
  println(s"\n学生 $studentId 的姓名是： $studentName")
  val mathSorces = List(85,92,88,90,86)
  val avg = calculateAverageScore(mathSorces)
  println(s"该学生的数学平均分是：$avg")
  println(s"平均分是否及格${calculateAverageScore(mathSorces)>=60}")
}
